package demo1.demo1.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;

//templates目录下的所有页面,只能通过controller来跳转
//需要模板引擎的支持
@Controller //等于@Controller和@RequestBody
public class HelloController {
    @ResponseBody
    @RequestMapping("/hello")
    public String Handle01(){
        return "Hello,Spring Boot 2!";
    }

    @RequestMapping("/login")
    public  String Handle02(){
        return "login";
    }

    @RequestMapping("/play")
    public  String Handle03(Model model){
        model.addAttribute("msg","Hello,Thymeleaf");
        model.addAttribute("infoList", Arrays.asList("weather","sleep","sing"));
        return "play";
    }
}
